﻿namespace class11_3_数组排序_冒泡
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int[] hju = { 2,5,3,4,9,45,21,7};
            int i, j;
            int k = 0;
            
            Console.WriteLine("原数组为：");
            foreach(int n in hju)
            {
                Console.Write(n+" ");
            }
            Console.WriteLine();
             for(i=0;i<hju.Length-1;i++)
            {
                j = i + 1;
            gy:
                
                if (hju[i] > hju[j])
                {
                    k = hju[i];
                    hju[i] = hju[j];
                    hju[j] = k;

                    goto gy;
                    

                }
                else
                {
                    if (j < hju.Length - 1)
                    {
                        j++;
                        goto gy;

                    }

                }
                
            }
             Console.WriteLine("修改后的数组为：") ;
            foreach (int f in hju)
            {
                Console.Write(f+" ");
            }



        }
    }
}
